#include <iostream>
#include <vector>
#include <string>
//#include "iostream"
#include<iomanip> 
#include <time.h>
#include "recursion.h"
#include <chrono>
#define setbit(x,y)  (x|=(1<<y)) //let the y bit be 1  
#define twosetbit(x,y,z) (x|=((1<<y)|(1<<z)))
#define clrbit(x,y)  (x&=~(1<<y)) //let the y bit be 0
#define twoclrbit(x,y,z) (x&=~((1<<y)|(1<<z)) )
#define reversebit(x,y)  (x^=(1<<y)) //reverse the y bit
#define getbit(x,y)   ((x) >> (y)&1) //get the y bit number begin with the 0 bit
#define getsigarraybit(a,b) (((*(a+((b&0xffffffe0)>>5))) >> ((b%32)))&1)
#define reversesigarraybit(a,b)  ((*(a+((b&0xffffffe0)>>5)))^=(1<<(b%32)))
//#define getarraybit(x,y) ()
using namespace std;
extern unsigned long long int SequenceLowEnergy;
extern double currentenergy;
//extern double currentenergy1;
extern long int count;
/*int test(int i){
     if(i<76680){return i;}
        if(i-->=6680){
            test(i);
        }

}*/
unsigned GetArrayBit(unsigned long long int *a,unsigned int b){
    return  getbit(*(a+((b&0xffffffc0)>>6)),(b%64));

}
int main()
{ 
   // cout<<"aa";
     testall();
      NewPivot_saw(/*int BitNumber,unsigned int*BitArray*/);
   // cout<<"bb";
    static unsigned long long int  Sequence;
   // cout<<Sequence<<sizeof(Sequence);
    Sequence=0x00;
    /*for(int i=0;i<=7;i++){
        cout<<getbit(Sequence,i)<<"tt"<<endl;
    }*/
    //
    //Sequence=0x10;
    //cout<<setbase(16)<<(Sequence>>4)<<Sequence<<endl;
    //cout<<hex<<setbit(Sequence,2)<<"d"<<endl;
   // cout<<twoclrbit(Sequence,0,1)<<endl;
    //cout<<twosetbit(Sequence,3,1);
    //cout<<add(1,1);
    //clock_t start, finish;
    //auto beforeTime = std::chrono::steady_clock::now();
    clock_t start, finish;
	double Total_time;
start = clock();
   /* int cycle=0;
    for(cycle=7;cycle<=20;cycle++){
    SequenceRecursion(Sequence,cycle,-1,0,cycle);
     std::cout<<"energy"<<currentenergy<<endl;
     currentenergy=1000;
    }*/
    //NewPivot_saw();
    //SequenceRecursion(Sequence,31,-1,0,31);
   // cout<<test(1000000)<<endl;
    

     //cout<<"sequence;;"<<hex<<SequenceLowEnergy<<endl;
        // cout<<"energy::"<<NotRecursin(Sequence,12,-1,0,1000,12)<<endl;
        //bbbbb();
        //cout<<"energy:::"<<BestNotRecursion(Sequence,28,-1,0,1000,28)<<endl;
        //cout<<endl<<"aaaaaaaaaaaaaaaaaaa"<<abs((-6+5)%4);
finish = clock();
	Total_time = (double)(finish - start) / CLOCKS_PER_SEC; //单位换算成秒
	std::cout<<Total_time<<"秒"<<endl;
    //cout<<"sequence:"<<hex<<SequenceLowEnergy<<endl;
    //cout<<"optimize energy:"<<currentenergy1<<endl;

    //cout <<"vvvvvv"<<currentenergy;
   // cout<<"count"<<hex<<count;
  /*unsigned   int aa[20]={0};
   aa[1]=0xffffffff;
   unsigned  int bb=64;
   //cout<<"bit:"<<getbit(aa,1);
   cout<<sizeof(unsigned  long  long int);
   cout<<"arraynumber"<<getsigarraybit(aa,bb)<<endl/*"a"<<getbit(aa[1],32%32)*/;
   /*reversesigarraybit(aa,bb);
   cout<<hex<<aa[1]<<endl;
   cout<<"reverse"<<getsigarraybit(aa,bb);*/

/*Sequence=0x1f35;
 double Energy=0;
    int Autocorrelations=0;
    int ssss=13;
   for(int i=0;i<ssss;i++){
       for(int j=0;j<ssss-i;j++){
        int ii=(getbit(Sequence,j));
        //cout<<ii;
        int jj=(getbit(Sequence,(j+i)));
        //cout<<jj<<"aaa";
        if((ii==1)&&(jj==0)){
            Autocorrelations=Autocorrelations-1;
            Autocorrelations=Autocorrelations-1;
            //cout<<Autocorrelations<<"SS";
        }
        if(((ii==0)&&(jj==1))){
            Autocorrelations=Autocorrelations-1;
            Autocorrelations=Autocorrelations-1;
            //cout<<Autocorrelations<<"DD";
        }
        Autocorrelations=Autocorrelations+1;
        //cout<<Autocorrelations<<"W";
        //int jj=(unsigned)(getbit(Sequence,(j+i)));
       // if(jj==0){
       //     jj--;
      //  }
          // Autocorrelations=Autocorrelations+(~(getbit(Sequence,j)^getbit(Sequence,(j+i))))*2-1;
          //Autocorrelations=Autocorrelations+ii*jj;
       }
       //cout<<Autocorrelations<<"AAAA"<<endl;
       Energy=Energy+Autocorrelations*Autocorrelations;
       Autocorrelations=0;
       
   }
   cout<<"qqqq"<<Energy-ssss*ssss;*/



}